package MineGod;

import org.lwjgl.opengl.GL11;
import org.newdawn.slick.geom.Shape;
import org.newdawn.slick.geom.Circle;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.opengl.Texture;

public class ItemEntityGunpowder extends ItemEntity{

	static Texture gunpowderTex;
	
	
	public ItemEntityGunpowder(ItemEntityType tempType, double x, double y){
		super(tempType, x, y);
		itemID = 0;
		width = 12;
		height = 12;
		maxAge = -1;
		age = 0;
		mask = new Rectangle((float)(this.x), (float)(yPos), (float)(width), (float)height);
	}
	
	
	public void doLogic(int delta, Chunk prevChunk, Chunk currChunk, Chunk nextChunk){
		x += xSpeed*speed*delta;
		yPos += ySpeed*speed*delta;
		age += delta;
		mask.setLocation((float)(x + width/2), (float)(yPos+height/2));
	}
	
	
	
	public void interactWithPlayerOnCollision(Player player){
		//System.out.println("Collided With GunpowderEntity!");
		//add gunpoweder to player.
		player.inventory[itemID] = player.inventory[itemID]+1;
		// set entity to dead.
		dead = true;
	}
	
	
	public void render(double worldPos){
		GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
		gunpowderTex.bind();
		double renderX = x - worldPos;
		GL11.glColor3d(1, 1, 1); 
		GL11.glBegin(GL11.GL_QUADS);
			GL11.glNormal3d(0, 0, 1);
			GL11.glTexCoord2d(0.0, 0.0);
			GL11.glVertex3d(renderX, yPos, zIndex);
			GL11.glTexCoord2d(1.0, 0.0);
			GL11.glVertex3d(renderX + width, yPos, zIndex);
			GL11.glTexCoord2d(1.0, 1.0);
			GL11.glVertex3d(renderX + width, yPos + width, zIndex);
			GL11.glTexCoord2d(0.0, 1.0);
			GL11.glVertex3d(renderX, yPos + width, zIndex);
		GL11.glEnd();
	}
	
	
	
}
